package com.platform.comm.common.batch.listener;

import com.platform.vo.ImportDto;
import lombok.extern.log4j.Log4j2;
import org.springframework.batch.core.ItemWriteListener;

import java.util.List;

@Log4j2
public class CustomItemWriterListener implements ItemWriteListener<ImportDto> {

    private long totalCount = 0;

    @Override
    public void beforeWrite(List<? extends ImportDto> items) {
        totalCount += items.size();
        log.info("已处理输出数据总量" + totalCount);
    }

    @Override
    public void afterWrite(List<? extends ImportDto> items) {
        log.info("已完成写入。。。" + totalCount);
    }

    @Override
    public void onWriteError(Exception exception, List<? extends ImportDto> items) {

    }
}
